package com.example.vuecms.controller;

import com.example.vuecms.entity.Banner;
import com.example.vuecms.entity.GoodsBanner;
import com.example.vuecms.entity.Result;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("banner")
public class BannerController {

    @RequestMapping("list")
    @CrossOrigin(origins="*",allowCredentials="true")
    public Result list() {
        Banner b1 = new Banner(1, "aaa", "http://qiniu.chegushi010.com/upload/20181228/590aa4aab7034fa6b96de1b062caad1d");
        Banner b2 = new Banner(2, "aaa", "http://qiniu.chegushi010.com/upload/20181228/dd844545c92740cb96ae62f76b8022d1");
        List<Banner> list = new ArrayList<Banner>();
        list.add(b1);
        list.add(b2);
        Result result = new Result(0, list);
        return result;
    }

    @RequestMapping("goodslist")
    @CrossOrigin(origins="*",allowCredentials="true")
    public Result goodslist() {
        GoodsBanner b1 = new GoodsBanner(1, "aaa", "https://img12.360buyimg.com/n7/jfs/t27328/348/1322253158/210285/301e901e/5bc57dc1N79b78245.jpg");
        GoodsBanner b2 = new GoodsBanner(2, "aaa", "https://img12.360buyimg.com/n7/jfs/t1/9988/1/6329/207189/5be0eb40E703c9be9/090a77bcd0ae28d7.jpg");
        GoodsBanner b3 = new GoodsBanner(3, "aaa", "https://img10.360buyimg.com/n7/jfs/t1/28438/30/3457/208352/5c26df06Ea550028d/1be54febd9dc2ed1.jpg");
        List<GoodsBanner> list = new ArrayList<GoodsBanner>();
        list.add(b1);
        list.add(b2);
        list.add(b3);
        Result result = new Result(0, list);
        return result;
    }
}
